<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Publisher Entry Formt</title>
<style type="text/css">
body {
	background-color: #eff3f6;
}
form.entry {
background: -webkit-gradient(linear, bottom, left 175px, from(#CCCCCC), to(#EEEEEE));
background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
margin:auto;
position:relative;
width:390px;
height:480px;
top:70px;
left:5px;
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-style: italic;
line-height: 24px;
font-weight: bold;
color: #000;
text-decoration: none;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding:10px;
border: 1px solid #999;
border: inset 1px solid #333;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
}

input    {
width:275px;
display:block;
border: 1px solid #999;
height: 25px;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
}
input.submit {
	width: 100px;
	position: absolute;
	
	background: #660000;
	color: #fff;
	font-family: Tahoma, Geneva, sans-serif;
	height: 30px;
	-webkit-border-radius: 15px;
	-moz-border-radius: 15px;
	border-radius: 15px;
	border: 1p solid #999;
	background-color: #660000;
}
input.submit:hover {
background:#fff;
color:#660000;
}
textarea:focus, input:focus {
border: 1px solid #FF6600;
}
</style>
</head>

<body>
<div>
<h2 align="center">New Publisher Entry Form</h2>
<form method="post" action="publisher.php" id="pfinds" name="pfinds" class="pfind">
<?php
$addr="";
if(isset($_GET['pubedit']))
{
print("
<style type=text/css>
form.pfind {
background: -webkit-gradient(linear, bottom, left 175px, from(#CCCCCC), to(#EEEEEE));
background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
margin:auto;
position:absolute;
right:0px;
width:390px;
height:30px;
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-style: italic;
line-height: 24px;
font-weight: bold;
color: #000;
text-decoration: none;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding:10px;
border: 1px solid #999;
border: inset 1px solid #333;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);		
}
input.submit2 {
	width: 100px;
	position: absolute;
	bottom:10px;
	background: #660000;
	color: #fff;
	font-family: Tahoma, Geneva, sans-serif;
	height: 30px;
	-webkit-border-radius: 15px;
	-moz-border-radius: 15px;
	border-radius: 15px;
	border: 1p solid #999;
	background-color: #660000;
}
</style>
<table><tr>
<td><input type=text name=findpub id=findpub placeholder=\"Search Options: First or Last Name, Group No, DOB\" /></td>
<td><input type=submit name=find value=Search id=find class=submit2 /></td>
</tr></table>");
exit;	
}
if(isset($_POST['find']))
{
	include("conn.php");
	$fstr=$_POST['findpub'];
$dis="<h4 align=left>Search Results For \"$_POST[findpub]\"</h4>
<div align=center>
<style type=text/css>
table.imagetable {
	font-family: verdana,arial,sans-serif;
	font-size:14px;
	color:#333333;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
}
table.imagetable th {
	background:#b5cfd2 url(cell-blue.jpg);
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
table.imagetable td {
	background:#dcddc0 url(cell-grey.jpg);
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
</style>
<table class=imagetable width=90%>
<tr align=left>
	<th>First Name</th>
	<th>Last Name</th>
	<th>D.O.B</th>
	<th>Date of Baptism</th>
	<th>Address</th>
	<th>Cell No.</th>
	<th>Sex</th>
	<th>Group</th>
	<th>Overseer</th>
	<th>Status</th>
</tr>";
$ss="select * from publishers where lcase(lname) like lcase('$fstr%') or lcase(fname) like lcase('$fstr%') or (pubgrpnum='$fstr' and pubgrpnum !=0) or dob = '$fstr' order by lname, fname asc";
$q=mysql_query($ss,$conn) or die(mysql_error());
if(mysql_num_rows($q)>0){
	$st=array("InActive", "Active");
	$sx=array("Male","Female");
	$po=array("Yes","No");
	while($t=mysql_fetch_array($q)){
		$i=$t['state'];
		if($i==1){
		$j=$t['grpoverseerstatus'];
		$k=$t['sex'];
		$addr="$t[addr]";
$dis.="<tr>
	<td><a href=publisher.php?edit=true&pid=$t[pubid]&ln=$t[lname]&fn=$t[fname]&dob=$t[dob]&dobap=$t[dobap]&sx=$t[sex]&pg=$t[pubgrpnum]&po=$t[grpoverseerstatus]&st=$t[state]&cell=$t[cellnum]&addr=\"$addr\">$t[fname]</a></td>
	<td>$t[lname]</td>
	<td>$t[dob]</td>
	<td>$t[dobap]</td>
	<td>$addr</td>
	<td>$t[cellnum]</td>
	<td>$sx[$k]</td>
	<td>$t[pubgrpnum]</td>
	<td>$po[$j]</td>
	<td>$st[$i]</td>
	
</tr>
";
		}
	}
}
$dis.="</table>";
print("$dis");
exit;
}
?>
</form></div>
<div><form id="form1" name="form1" method="post" action="addpub.php" class="entry">
  <table width="374" align="center" cellpadding="3" cellspacing="1">
    <tr>
      <td width="80" align="right">First Name:</td>
      <td width="277"><input type="text" name="fname" id="fname" required="required"
      <?php
	  if(isset($_GET['edit'])){
		print("value=$_GET[fn]");  
	  }
	  ?> /></td>
    </tr>
    <tr>
      <td align="right">Last Name:</td>
      <td><input type="text" name="lname" id="lname" required="required"
      
       <?php
	  if(isset($_GET['edit'])){
		print("value=$_GET[ln]");  
	  }
	  ?> /></td>
    </tr>
    <tr>
      <td align="right">Sex:</td>
      <td><select name="sex" id="sex">
        <option value="0" selected="selected">Male</option>
        <option value="1">Female</option>
        <?php
	   $sx=array("Male","Female");
	  if(isset($_GET['edit'])){
		  $i=$_GET['sx'];
		print("<option value=$i selected=selected>$sx[$i]</option>");  
	  }
	  ?> 
      </select></td>
    </tr>
    <tr>
      <td align="right">DOB:</td>
      <td><input type="text" name="dob" id="dob" required="required" placeholder="Required Format: yyyy-mm-dd"
      <?php
	  if(isset($_GET['edit'])){
		print("value=$_GET[dob]");  
	  }
	  ?>
       /></td>
    </tr>
    <tr>
      <td align="right">D.O.Bap:</td>
      <td><input type="text" name="dobap" id="dobap" required="required" placeholder="Required Format: yyyy-mm-dd" 
      <?php
	  if(isset($_GET['edit'])){
		print("value=$_GET[dobap]");  
	  }
	  ?>
      /></td>
    </tr>
     <tr>
      <td align="right">Cell No:</td>
      <td><input type="text" name="cell" id="cell" 
      <?php
	  if(isset($_GET['edit'])){
		print("value=$_GET[cell]");  
	  }
	  ?>
      /></td>
    </tr>
     <tr>
      <td align="right">Address:</td>
      <td><textarea name="addr" id="addr" cols="30" rows="3">
      <?php
	  if(isset($_GET['edit'])){
		print(trim("$_GET[addr]"));  
	  }
	  ?>
      </textarea></td>
    </tr>
    <tr>
      <td align="right">Status:</td>
      <td><select name="state" id="state">
        <option value="1" selected="selected">Active</option>
        <option value="0">InActive</option>
      </select></td>
    </tr>
    <tr>
      <td align="right">Group No:</td>
      <td><input type="text" name="pubgrpnum" id="pubgrpnum"  required="required"
      <?php
	  if(isset($_GET['edit'])){
		print("value=$_GET[pg]");  
	  }
	  ?>
      /></td>
    </tr>
    <tr>
      <td align="right">Overseer:</td>
      <td><select name="pubov" id="pubov">
        <option value="0">Yes</option>
        <option value="1" selected="selected">No</option>
      </select></td>
    </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td><input name="Addpub" type="submit" class="submit" id="Addpub" value="Add Publisher" /><input type="hidden" name="pubid" 
      <?php
	   if(isset($_GET['edit'])){
		print("value=$_GET[pid]");  
	  }
	  ?>
      /></td>
    </tr>
  </table>
</form></div>
</body>
</html>